package ClassExercise;

public class CircleCylinder extends Cylinder{
    private double radius;
    public double calculateArea() {
        //属性无继承性 所以this.属性仍然是调用父类中定义的属性
        return Math.PI * radius *radius*this.getH();

    }

    public CircleCylinder() {
    }

    public CircleCylinder(double radius) {
        this.radius = radius;
    }
    //测试
    public static void main(String[] args) {
        CircleCylinder circle = new CircleCylinder(2.0);
        circle.setH(2.0);
        System.out.println(circle.calculateArea());
    }
}
